<?php
namespace Tbf\Component\Path\Tests;
use Tbf\Bundle\TestBundle\TestSuite\TbfTestCase;
use Tbf\Component\Path\PathFunction;

class PathFunctionTest extends TbfTestCase{
    function testUrlJoin(){
        $this->assertEquals('http://a.com/a/',PathFunction::urlJoin('http://a.com/','/a/'));
        $this->assertEquals('http://a.com/a/c/',PathFunction::urlJoin('http://a.com/','/a/','/c/'));
        $this->assertEquals('http://a.com/a/c',PathFunction::urlJoin('http://a.com','a','c'));
        $this->assertEquals('http://a.com/a//b/c/d',PathFunction::urlJoin('http://a.com','a//b/c','d'));
    }
    function testFilePathJoin(){
        $this->assertEquals('http://a.com/a/',PathFunction::filePathJoin('http://a.com/','/a/'));
        $this->assertEquals('http://a.com/a/c/',PathFunction::filePathJoin('http://a.com/','/a/','/c/'));
        $this->assertEquals('http://a.com/a/c',PathFunction::filePathJoin('http://a.com','a','c'));
        $this->assertEquals('http://a.com/a//b/c/d',PathFunction::filePathJoin('http://a.com','a//b/c','d'));
    }
    function testNormalUrl(){
        $this->assertEquals('http://a.com/a/',PathFunction::normalUrl('http://a.com/a/'));
        $this->assertEquals('http://a.com/a/',PathFunction::normalUrl('http://a.com/a//'));
        $this->assertEquals('http://a.com/a',PathFunction::normalUrl('http:///a.com/a'));
        $this->assertEquals('http://a.com/a',PathFunction::normalUrl('http://////////a.com/////a'));
        $this->assertEquals('http:/://a.coma',PathFunction::normalUrl('http:/:///a.coma'));

    }
}